﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using PServiceBus.Core.Runtime;

namespace PServiceBus.Core.Runtime {
    public static class ThreadPoolBootStrapper {

        public static void Setup(bool setThreadPool = true) {
            if (!setThreadPool) return;
            int maxWorkers = 0, maxCompletionPorts = 0;
            ThreadPool.GetMaxThreads(out maxWorkers, out maxCompletionPorts);
            ThreadPool.SetMinThreads(maxWorkers - 1, maxCompletionPorts);
        }
    }
}
